xml.instruct!

xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do
  xml.channel do

    xml.title       "#{Settings.short_title} Videos"
    xml.link        url_for :only_path => false, :controller => 'posts'
    xml.pubDate     CGI.rfc1123_date @videos.first.updated_at if @videos.any?
    xml.description "#{Settings.short_title} Videos"

    @videos.each do |video|
      xml.item do
        xml.title       video.title
        xml.link        url_for :only_path => false, :controller => 'video', :action => 'show', :id => video
        xml.description video.body
        xml.pubDate     CGI.rfc1123_date video.updated_at
        xml.guid        url_for :only_path => false, :controller => 'video', :action => 'show', :id => video
        xml.author      "#{video.author.email} (#{video.author.name})"
        # This involves a nasty hack to get it to insert the full URL to the file
        xml.enclosure(:type => video.content_type,
                        :length => video.size.to_s,
                        :url => url_for(:controller => "/", :only_path => false).gsub("/", "") + video.public_filename
                  )
      end
    end

  end
end